<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:sec="http://www.springframework.org/security/tags"
	xmlns:p="http://primefaces.org/ui">

	<h:panelGroup style="padding-left: 30px;" layout="block">
		<h:form>
			<sec:authorize ifAnyGranted="ROLE_USER">
				<div class="juice-recipe-action">
					<i class="icon-plus"></i>
					<p:commandButton styleClass="btn btn-link" 
						value="Créer une recette" action="#{C_RECIPE.editNew}"> 
					</p:commandButton>
				</div>
				<hr style="margin-top: 5px;margin-bottom: 5px;" />
			</sec:authorize>
			<ui:repeat var="r" value="#{C_RECIPE_SEARCH.paginator.current}"
				varStatus="s">
				<p class="lead">
					#{r.name}
					<p:rating style="margin-top: -20px;" value="#{r.rating}"
						readonly="true" />
					<br />
				</p>
				<p>#{r.comment}</p>
				<!-- 
				<p class="muted">
					<h:outputText value="Inventé le " />
					<h:outputText value="#{r.created}">
						<f:convertDateTime timeStyle="long" />
					</h:outputText>
					<h:outputText
						value=" par #{r.author.nickName}." />
					<ui:fragment rendered="#{r.modified ne r.created}">
						<br />
						<h:outputText value="Affiné le " />
						<h:outputText value="#{r.modified}">
							<f:convertDateTime timeStyle="long" />
						</h:outputText>
					</ui:fragment>
				</p>
				 -->

				<div class="juice-recipe-action">
					<i class="icon-eye-open"></i>
					<p:commandButton ajax="false" styleClass="btn btn-link"
						value="voir" action="#{C_RECIPE.read}">
						<f:setPropertyActionListener target="#{C_RECIPE.recipe}"
							value="#{r}"></f:setPropertyActionListener>
					</p:commandButton>
				</div>
			</ui:repeat>
			<h:panelGroup rendered="#{C_RECIPE_SEARCH.paginator.psize > 1}"
				layout="block" style="margin-top: 20px;">
				<hr />
				<div class="controls">
					<h:commandButton
						styleClass="#{C_RECIPE_SEARCH.previous ? 'btn btn-mini' : 'btn disabled btn-mini'}"
						value="Précédent" action="#{C_RECIPE_SEARCH.getPrevious}"
						disabled="#{! C_RECIPE_SEARCH.previous}" />
					<strong><small><h:outputText
								style="margin-left: 20px; margin-right: 20px;"
								value="#{C_RECIPE_SEARCH.paginator.displayIndex} / #{C_RECIPE_SEARCH.paginator.psize}" />
					</small></strong>
					<h:commandButton
						styleClass="#{C_RECIPE_SEARCH.next ? 'btn btn-mini' : 'btn disabled btn-mini'}"
						value="Suivant" action="#{C_RECIPE_SEARCH.getNext}"
						disabled="#{! C_RECIPE_SEARCH.next}" />
				</div>
			</h:panelGroup>
		</h:form>
	</h:panelGroup>

</ui:composition>
